﻿
@inject IRelationUserService rService
@{
    var lstItem = rService.GetRelationByUserId(ViewData["UserId"].ToString(), 0);
    Layout = null;
}
@model List<RoleEntity>
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">设置角色</h4>
    </div>
    <div class="modal-body">
        <div class="jstree">
            <ul>
                <li data-jstree='{"opened":true,"icon":"fa fa-user"}'>
                    角色
                    <ul>
                        @{
                        if (Model != null && Model.Count > 0)
                        {
                        foreach (var item in Model)
                        {
                        bool selected = (lstItem != null && lstItem.Where(x => x.ResourceId == item.RoleId).FirstOrDefault() != null);
                        <li data-jstree='{"icon":"fa fa-user","selected":@selected.ToString().ToLower(),"id":"@item.RoleId"}' id="@item.RoleId">
                            @item.RoleName
                        </li>
                        }
                        }

                        }

                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="modal-footer">

    </div>
